import request from '@/utils/request';

const baseUrl = '/system/menu';

/**
 * 查询系统菜单列表
 * @param query 查询条件 SysMenuQuery
 * @returns 
 */
export function getList(query?: SysMenuQuery) {
    return request({
        url: `${baseUrl}/search`,
        method: 'POST',
        data: query
    });
}
// 删除菜单
export function deleteMenu(id:number) {
    return request({
        url: `${baseUrl}/${id}`,
        method: 'DELETE',
        data: id
    });
}
// 查询所有菜单用于下拉框
export function menuSelect(id?:number) {
    return request({
        url: `${baseUrl}/select`,
        method: 'GET',
        params:id
    });
}
// 新增提交表单
export function add(data: SysMenuType) {
    return request({
        url: `${baseUrl}`,
        method: 'POST',
        data, // data: data
    });
}
/**
 * 修改菜单
 * @returns 
 */
export function update(data: SysMenuType) {
    return request({
        url: `${baseUrl}`,
        method: 'PUT',
        data, // data: data
    });
}